package com.zhicheng.backend.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhicheng.backend.entity.User;
import com.zhicheng.backend.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 功能:
 * 作者:YukiSu
 * 日期:2024/11/28 21:03
 */
@RestController
@RequestMapping("/user")
public class UserController {
    UserService userService;
    @Autowired
    public UserController(UserService userService) {

        this.userService = userService;
    }

@GetMapping("/listByPage")
    public List<User> listUserByPage() {
        IPage<User> page = new Page<>(1, 10);
        IPage<User> userPage = userService.page(page);
        return userPage.getRecords();
    }

}